Skip to content

Document policyengine.py household-impact zero-return diagnosis (#1628)#1729

Open
vahid-ahmadi wants to merge 1 commit into
mainfrom
vahid-ahmadi/issue-1628-household-impact-tests-diagnosis
Open

Document policyengine.py household-impact zero-return diagnosis (#1628)#1729
vahid-ahmadi wants to merge 1 commit into
mainfrom
vahid-ahmadi/issue-1628-household-impact-tests-diagnosis

Conversation

@vahid-ahmadi
Copy link
Copy Markdown
Collaborator

Summary

  • Household-impact tests return 0 for expected-positive tax/benefit values on 2.88.0 #1628 reported that two policyengine.py household-impact integration tests started asserting 0.0 for expected-positive tax / child-benefit values after bumping the UK extra to policyengine-uk==2.88.0.
  • Reproduced the two scenarios directly against policyengine-uk main:
    • £50k single adult: income_tax = 7486.00
    • Couple with one 5-year-old: child_benefit = 1354.60
  • The figures are stable across 2022–2025, so the underlying model is healthy — this is an upstream policyengine.py test-harness regression, most likely from:
    • the default_input_period / default_calculation_period defaulting to 2025 (so a 2024 situation queried at the default returns 0 for unset inputs), or
    • the default-dataset env-var requirement introduced around 2.79.x being swallowed by the harness and falling through to a zero-filled simulation.
  • New page at docs/book/validation/policyengine-py-household-impact.md documenting the diagnosis from the UK side and providing guidance for the upstream fix (pass explicit period=, use Microsimulation(situation=...) for single-household queries, assert against the fixture-encoded year).
  • Cross-links to mp30k-uk-switch-plan.md which documents the env-var contract this collides with.
  • Pure documentation; no code changes. The actual fix lives in policyengine.py's test harness.

Test plan

  • Reproduced both scenarios directly via Microsimulation(situation=...); figures match the expected values.
  • Markdown lints cleanly.
  • Docs build job picks up the new page under validation/.

🤖 Generated with Claude Code

#1628 reported that two policyengine.py household-impact integration
tests started asserting 0.0 for expected-positive tax / child-benefit
values after bumping to policyengine-uk==2.88.0.

Reproducing the same scenarios directly against policyengine-uk shows
the model is healthy: a £50k single adult correctly returns £7,486
income tax, and a couple with one child correctly returns £1,354.60
child benefit at 2025 rates. The figures are stable across 2022-2025.

So the regression is upstream in policyengine.py's test harness, not
a model bug. Most likely cause: the harness depending on the model's
default_input_period (2025) vs the year encoded in the test fixture,
or being broken by the default-dataset env var requirement introduced
since the previous 2.74 pin.

Persist the diagnosis as a docs page so the next reviewer of #1628
gets a one-stop explanation. Guidance for the upstream fix:

- pass explicit period= to every calculate() call,
- use Microsimulation(situation=...) for single-household queries
  (no dataset needed),
- assert against the fixture-encoded year rather than the model's
  default.

Cross-links to mp30k-uk-switch-plan.md which documents the env-var
contract this issue collides with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant